﻿using System.Collections.Generic;

namespace Ants.SimpleDistributionProblem.DTO
{
    /// <summary>
    /// Class representing solution.
    /// </summary>
    public class Solution
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Solution" /> class.
        /// </summary>
        public Solution()
        {
            this.Route = new List<RoutePart>();
        }

        /// <summary>
        /// Gets the cost.
        /// </summary>
        /// <value>
        /// The cost.
        /// </value>
        public double Cost
        {
            get
            {
                double cost = 0;
                foreach (RoutePart part in this.Route)
                {
                    cost += part.Cost;
                }

                return cost;
            }
        }

        /// <summary>
        /// Gets or sets the route.
        /// </summary>
        /// <value>
        /// The route.
        /// </value>
        public List<RoutePart> Route { get; set; }
    }
}